﻿<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！-->
    <title>学生惠后台管理系统</title>
    <link rel="stylesheet" href="/App/Admin/public/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="/App/Admin/public/css/style.css"/>
</head>
<body>
<div class="mainBody">
     <include file="Public:left"/>
    <div class="main">
         <include file="Public:top"/>

        <div class="subNav">
            <span class="text"><i class="iconFont">&#xe600;</i>商家管理 - 商品管理</span>
        </div>

        <div class="indexBox">
            <div class="con-det">
                <div class="row">
                    <div class="col-md-12">
                        <form action="{:U('Product/index')}" method="post">
                            <table class="formTable">
                                <tbody><tr>
                                    <td class="name noBor">关键字</td>
                                    <td class="noBor">
                                        <input type="text"   name="sh_q"  value="{$shArray.sh_q}" class="inp form-control" placeholder="商品名称">
                                    </td>
                                </tr>
                                <tr>
                                    <td class="name"></td>
                                    <td>
                                        <button class="btn btn-primary blue" type="submit">查询</button>
                                    </td>
                                </tr>
                                </tbody></table>
                        </form>
                    </div>
                </div>

                <div class="mt40 listBox">
                    <div class="listScroll">
                        <table class="table table-striped">
                            <tr>
                                <th>商家名</th>
                                <th>商品编号</th>
                                <th>商品名称</th>
                                <th>商品图片</th>
                                <th>商品分类</th>
                                <th>价格</th>
                                <th>添加时间</th>
                                <th>总销量</th>
                                <th>操作</th>
                            </tr>
                            <foreach name="list" item="item" >
                            <tr>
                                <td>{$item.shop_name}</td>
                                <td>{$item.id}</td>
                                <td>{$item.pro_name}</td>
                                <td><img src="{$item.pic_path}" width="200"></td>
                                <td>{$item.class_name}</td>
                                <td>￥{$item.price}</td>
                                <td>{$item.add_time|date='Y-m-d',###}</td>
                                <td>{$item.sale_num}</td>
                                <td>
                                    <a href="javascript:;"  id="is_home" cid='{$item.id}' state="{$item.is_home}" class="btn btn-default btn-xs"><if condition="$item.is_home eq 1 ">上架<else/>下架</if></a>
                                </td>
                            </tr>
                               </foreach>
                        </table>
                    </div>
                    <nav aria-label="Page navigation">
                        <ul class="pagination fr">
                            {$page}
                        </ul>
                    </nav>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="/App/Admin/public/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/App/Admin/public/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/App/Admin/public/js/time.js"></script>
<script type="text/javascript" src="/App/Admin/public/js/public.js"></script>


<script>
$('#is_home').click(function(){
    var t=$(this);
    var text=$(this).html();
    var mymessage=confirm("你确定"+text+"此商品");  
    if(mymessage==true)  
    {  
        var state=$(this).attr("state");
        var cid=$(this).attr("cid");
      
        $.get('{:U('Product/editHome')}',{cid:cid,state:state},function(data){
            if(data==100){
               if(text=="上架"){
                    t.html("下架");
               }else{
                    t.html("上架");

               }
			   location.reload();
            }
        })
    }  
    else if(mymessage==false)  
    {  
        
    }     
})
</script>
</body>
</html>








